home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / SUBARTIC / SUB_ARCT / TEST / TRANSP_T.JAV < prev    next >
Encoding:
Text File  |  1996-10-04  |  2.5 KB  |  92 lines

  1. /*
  2.  * $Id: transp_test.java,v 1.10 1996/10/03 19:46:51 hudson Exp $
  3.  * $Author: hudson $
  4.  */
  5.  
  6. package sub_arctic.test;
  7.  
  8. import sub_arctic.lib.interactor_applet;
  9. import sub_arctic.lib.manager;
  10. import sub_arctic.lib.interactor;
  11. import sub_arctic.lib.interactor_consts;
  12. import sub_arctic.lib.top_level;
  13. import sub_arctic.lib.base_parent_interactor;
  14. import sub_arctic.lib.icon;
  15. import sub_arctic.lib.label;
  16. import sub_arctic.lib.transparency_container;
  17. import sub_arctic.lib.drag_container;
  18. import sub_arctic.output.transparent_drawable;
  19. import java.awt.Font;
  20.  
  21. class t_test extends transparency_container {
  22.   public t_test(int x, int y)
  23.     {
  24.       super(x,y,255);
  25.     }
  26.  
  27.   public void configure()
  28.     {
  29.       int t;
  30.  
  31.       super.configure();
  32.  
  33.       // set transparency based on x position 
  34.       // (we are inside drag, so we go up one level to get real position)
  35.       t = (600 - parent().x())*255/600; 
  36.       if (t < 3) t = 3;
  37.       if (t > transparency_container.OPAQUE ) 
  38.     t = transparency_container.OPAQUE;
  39.       set_alpha_value(t);
  40.     }
  41. }
  42.  
  43. public class transp_test extends interactor_applet implements interactor_consts 
  44. {
  45.  
  46.   public void build_ui(base_parent_interactor top) 
  47.     {
  48.       interactor child, child1;
  49.       drag_container drag;
  50.       transparency_container trans;
  51.  
  52.       child = new label("<---- Drag To Change Transparency ---->", 
  53.             new Font("Helvetica",Font.BOLD,18));
  54.       child.set_pos(50,50);
  55.       top.add_child(child);
  56.  
  57.       drag = new drag_container(10,10, false);
  58.       top.add_child(drag);
  59.  
  60.       // trans = new transparency_container(0,0);
  61.       trans = new t_test(0,0);
  62.       drag.add_child(trans);
  63.  
  64.       try {
  65.     child = new icon(0,0,manager.load_doc_image(this,"images/gvu.gif"));
  66.     trans.add_child(child);
  67.  
  68.     child = new coord_tracker(10,70,"Pos = [", "]");
  69.     trans.add_child(child);
  70.       } catch (java.net.MalformedURLException e) {
  71.     showStatus("problem loading image for test");
  72.       }
  73.     }
  74. }
  75.  
  76. /*=========================== COPYRIGHT NOTICE ===========================
  77.  
  78. This file is part of the subArctic user interface toolkit.
  79.  
  80. Copyright (c) 1996 Scott Hudson and Ian Smith
  81. All rights reserved.
  82.  
  83. The subArctic system is freely available for most uses under the terms
  84. and conditions described in 
  85.   http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html 
  86. and appearing in full in the lib/interactor.java source file.
  87.  
  88. The current release and additional information about this software can be 
  89. found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
  90.  
  91. ========================================================================*/
  92.